Database concurrency control is the control process in a database system that allows interactive querying and updating of the stored data contents of the database system. The purpose of concurrency control is to ensure that the logical state of the database is consistent at all times. This means, for example, if a query and an update process are in progress at the same time, the query will receive the appropriate database information that existed before the update process began or, possibly, information that exists after the update process is completely finished. The query should not receive, however, information that represents a data state after the update begins but before it completes.
The property that ensures consistent data states of a database is called "serializability." The classic method of query and update processing is to lockout query functions while an update is occurring and vice versa. Thus, queries and updates take place in a serial format in the classic method. Any algorithm that can be shown to be equivalent to the classic serial scheme can be made to result in consistent database states.
In many types of databases, the query function is more important than the update function and should, therefore, be given preference over the update function. The classic concurrency control method is lacking in this respect because queries are locked out while updates are occurring. To mitigate this problem, some databases use a technique known as "shadowing." In this technique, the database entries (entry, record, page, etc.) on which updates are based are copied into a separate portion of memory that is not yet part of the present contents of the database. Update changes are then made to the copies. While, the "shadow" changes are being made, queries are referred to the unchanged database. When updating of the "shadow" copies is complete, queries are temporarily locked out and database linkages are then modified to point to the "shadow" copies rather than to the old data entries. Querying is then reallowed. The result is that queries are locked out for a shorter period of time than in the classic method.
While "shadowing" works well, it is clear that the control structure, i.e., the software, necessary to accomplish the result, is complicated. This is due in large part to the fact that different logic must be provided to account for the different types of semipermanent and temporary data structures present in such a system, i.e., the database memory, the "shadow" memory, the linkages that point to one or the other and administrative control functions. It is desirable to simplify the control structure and at the same time further shorten the time that query functions are locked out by updates, if possible.